<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text"  v-model="info" placeholder="请输入1-100之间的整数" id="i1">
  <input type="button" value="猜一猜" @click="f()">
  <h1 id="i2"></h1>
</div>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>
<script>

  let num =parseInt(Math.random()*100+1) ;
  let s = new  Vue({
    el:"div",
    data:{
      info:""
    },
    methods:{
      f:function () {
        if (s.info>num){
            i2.innerText="猜大了"
        }else if (s.info<num){
            i2.innerText="猜小了"
        } else{
            i2.innerText="猜对了"
        }
      }
    }

  })


</script>
</body>
</html>